#!/usr/bin/node 
//底层api打印文件内容
const fs = require('fs'),
      log = console.log;
//没有命令参数，默认打印脚本文件内容
const filename = process.argv[2] || __filename;
try {
  let fid = fs.openSync(filename, 'r');
  let size = fs.statSync(filename).size;
  let buf = new Buffer(size);

  fs.readSync(fid, buf, 0, size, 0);
  log(buf.toString('utf8'));
  fs.closeSync(fid);
  } catch(e) {
    console.error(e.message);
    process.exit(1);
  }

